package com.wpw.dream.thread;

public class ThreadInterruptTest {
	public static void main(String[] args) {
		
		System.out.println("isInterrupted :"  + Thread.currentThread().isInterrupted());//当前线程没有被中断，返回false；
		Thread.currentThread().interrupt();//中断了该线程，但是该线程仍会继续执行，该方法只是将线程的状态设置成“中断”状态
		System.out.println("isInterrupted :" + Thread.currentThread().isInterrupted());//interrupt()执行后，线程被设置成中断状态，返回true
		System.out.println("interrupted :" + Thread.interrupted());//返回了中断状态：true，又清掉了状态位。
		System.out.println("isInterrupted :" + Thread.currentThread().isInterrupted());//由于interrupted()清掉了状态位，所以返回false；
		System.out.println("interrupted :" + Thread.interrupted());
	}
}
